{include file="public/header" /}
<title></title>
</head>

<body>
	<article class="page-container">
		<form class="form form-horizontal" id="form-admin-add" method="post">
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" value="{$user_list.id}" id="id" name="id" style="display: none;">
					<input type="text" class="input-text" value="{$user_list.admin_name}" placeholder="" id="admin_name" name="admin_name">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>密码：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="password" class="input-text" autocomplete="off" value="" placeholder="密码" id="admin_password" name="admin_password">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>旧操作密码：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="password" class="input-text" autocomplete="off" value="" placeholder="旧操作密码" id="op_password" name="op_password">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>新操作密码：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="password" class="input-text" autocomplete="off" value="" placeholder="新操作密码" id="op_password1" name="op_password1">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>真实姓名：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="{$user_list.real_name}" placeholder="真实姓名" id="real_name" name="real_name">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">状  态：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<div class="radio-box">
						<input type="radio" value="0" name="status" id="status" {if condition="$user_list['status'] eq 0 " }checked{/if}>
						<label for="radio-2">正常</label>
						<input type="radio" value="1" name="status" id="status" {if condition="$user_list['status'] eq 1 " }checked{/if}>
						<label for="radio-2">禁用</label>
					</div>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">角色：</label>
				<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
			<select class="select" name="group_id" id="group_id" size="1">
				<option value="0">--默认--</option>
				{foreach name="list" item="vo"}
				<option value="{$vo.id}" {if condition="$group_id==$vo.id" } selected="selected" {/if}>{$vo.title}</option>
				{/foreach}
			</select>
			</span> </div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary radius" id='tijiao' type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</article>
	{include file="public/footer" /}
	<script type="text/javascript">
		$(function() {
			$('.skin-minimal input').iCheck({
				checkboxClass: 'icheckbox-blue',
				radioClass: 'iradio-blue',
				increaseArea: '20%'
			});

			$('#tijiao').click(function() {
				$.ajax({
					type: 'post',
					data: {
						id: $('#id').val(),
						admin_name: $('#admin_name').val(),
						admin_password: $('#admin_password').val(),
						op_pwd:$("#op_password").val(),
						op_pwd1:$("#op_password1").val(),
						real_name: $('#real_name').val(),
						status: $('input:radio:checked').val(),
						group_id: $('#group_id option:selected').val()
					},
					url: "{:url('users/admin_edit')}",
					success: function(data) {
						if(data.code == 200) {
							layer.msg(data.msg, {
								icon: 1,
								time: 1000
							}, function() {
								window.parent.location.reload();
								var index = parent.layer.getFrameIndex(window.name);
								parent.layer.close(index);
							});
						} else {
							layer.msg(data.msg, {
								icon: 1,
								time: 1000
							});
						}

					},
					error: function(XmlHttpRequest, textStatus, errorThrown) {
						layer.msg(data.msg, {
							icon: 1,
							time: 1000
						});
					}
				});
			});
		});
	</script>